var express = require('express');
var path = require('path');
var app = express();
var bodyParser = require('body-parser');
//body-parser只能解析单层对象
var select = require('./routes/select');
var all = require('./routes/selectall');
var add = require('./routes/add');
var updata = require('./routes/updata');
//模板引擎设置
app.set('views', path.join(__dirname, 'views'));
//app.set('view engine', 'jade');
app.engine("html",require("ejs").__express);
//设置视图模板引擎为html
app.set('view engine', 'html');

app.use(bodyParser.json()); 
app.use(bodyParser.urlencoded({
    extended: true
})); 

//设置路由

app.use('/select',select);
app.use ('/all',all);
app.use('/add',add);
app.use('/updata',updata);
app.listen(3000);
console.log("启动端口:3000");